//==========================================================================
// Copyright (c) 2000-2008,  Elastos, Inc.  All Rights Reserved.
//==========================================================================

#ifndef __ELASTOS_CONDITION_H__
#define __ELASTOS_CONDITION_H__

class DzMutex;

class DzCondition : public SyncObject
{
public:
    void UninterruptibleWait(DzMutex *pMutex);
    void Wait(DzMutex *pMutex, WaitResult *pResult);

    void TryUninterruptibleWait(
        DzMutex *pMutex, uint_t ticks, WaitResult *pResult)
    {
        TryUninterruptibleWait(pMutex, ticks, NULL, pResult);
    }

    void TryWait(DzMutex *pMutex, uint_t ticks, WaitResult *pResult)
    {
        TryWait(pMutex, ticks, NULL, pResult);
    }

    void TryUninterruptibleWait(
        DzMutex *pMutex, uint_t dueTicks,
        uint_t *pResidualTicks, WaitResult *pResult);

    void TryWait(
        DzMutex *pMutex, uint_t dueTicks,
        uint_t *pResidualTicks, WaitResult *pResult);

    void Pulse(register bool_t bWaiveInheritedPriority = FALSE)
    {
        WakeUpOneWaiter(bWaiveInheritedPriority);
    }

    void PulseAll(register bool_t bWaiveInheritedPriority = FALSE)
    {
        WakeUpAllWaiters(bWaiveInheritedPriority);
    }
};

#endif //__ELASTOS_CONDITION_H__
